package com.star.book.controller.system;

import com.star.book.entity.StarBook;
import com.star.book.entity.User;
import com.star.book.service.IStarBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 网站登录日志记录
 * */
@Controller
public class SysStarInfoController {

    @Autowired
    private IStarBookService starBookService;

    @GetMapping("/sys/starInfo")
    public String starInfo(Model m, @RequestParam Integer id){
        User user = SysUserInfo.loginInfo();
        m.addAttribute("user",user);
        Map<String, Object> stringObjectMap = starBookService.starBookLog(id);
        Integer page = (Integer) stringObjectMap.get("page");
        m.addAttribute("page",page);
        List<StarBook> starBookByPage = (List<StarBook>) stringObjectMap.get("starBookByPage");
        m.addAttribute("starBook",starBookByPage);
        return "system/starBookInfo";
    }
}
